package com.hy.demo.ui;

import android.widget.TextView;

import com.gyf.immersionbar.BarHide;
import com.gyf.immersionbar.ImmersionBar;
import com.hy.demo.BuildConfig;
import com.hy.demo.R;
import com.hy.demo.app.BaseActivity;
import com.hy.frame.util.ActUtil;
import com.hy.frame.util.TimerUtil;

/**
 * title 无
 * author heyan
 * time 19-8-15 上午10:00
 * desc 无
 */
public class LaunchActivity extends BaseActivity implements Runnable {

    private TextView txtMsg;
    private TimerUtil timer;

    @Override
    protected boolean isSingleLayout() {
        return true;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.v_launch;
    }

    @Override
    protected void initView() {
        ImmersionBar.with(this).transparentBar().hideBar(BarHide.FLAG_HIDE_BAR).init();
        txtMsg = findViewById(R.id.launch_txtMsg);
    }

    @Override
    protected void initData() {
        txtMsg.setText(getString(R.string.launch_str, BuildConfig.VERSION_NAME));
        timer = new TimerUtil(getContext());
        timer.delayed(1500L, this);
    }

    @Override
    public void run() {
        timer.cancel();
        timer = null;
        ActUtil.startAct(this, MainActivity.class);
        finish();
    }
}
